home *** CD-ROM | disk | FTP | other *** search
- Path: chronicle.mti.sgi.com!news
- From: austern@isolde.mti.sgi.com (Matt Austern)
- Newsgroups: comp.lang.c++
- Subject: Re: pow(-1,1.1) = DOMAIN error
- Date: 22 Feb 1996 17:30:39 GMT
- Organization: SGI
- Message-ID: <AUSTERN.96Feb22093039@isolde.mti.sgi.com>
- References: <Christian.Straka.15.0010E3C9@uni-konstanz.de>
- Reply-To: austern@mti.sgi.com
- NNTP-Posting-Host: isolde.mti.sgi.com
- In-reply-to: Christian.Straka@uni-konstanz.de's message of Thu, 22 Feb 1996 16:53:16
-
- In article <Christian.Straka.15.0010E3C9@uni-konstanz.de> Christian.Straka@uni-konstanz.de (Christian Straka) writes:
-
- > The pow() and powl() function in <math.h> doesn't work properly. The following
- > example causes a DOMAIN error exception (see defs in math.h):
- >
- > pow(-1,1.1);
- >
- > Has anyone an idea to fix this problem?
-
- Two choices. First choice: use a version of pow() that knows about
- complex numbers. If you #include complex.h, then pow(complex(-1), 1.1)
- ought to do the trick.
-
- Second choice: don't do it. If you're looking for a real answer, then
- you've done your math wrong. There's no way that pow(-1,1.1) can give
- you a real number, whether you're using C, C++, Eiffel, or Fortran:
- mathematically, (-1) ^ 1.1 is not real.
- --
- Matt Austern
- SGI: MTI Compilers Group
- austern@isolde.mti.sgi.com
-